<template>
  <div>
    <svg :style="{ width: width, height: height }" aria-hidden="true" class="icon" v-on="$listeners">
      <use :fill="color" :xlink:href="prefix + name"></use>
    </svg>
  </div>
</template>
<script lang="ts" setup>
import 'virtual:svg-icons-register'

defineProps({
  //xlink:href属性值的前缀
  prefix: {
    type: String,
    default: '#icon-'
  },
  //svg矢量图的名字
  name: String,
  //svg图标的颜色
  color: {
    type: String,
    default: ''
  },
  //svg宽度
  width: {
    type: String,
    default: ''
  },
  //svg高度
  height: {
    type: String,
    default: ''
  },

})
</script>
<style scoped>
.icon {
  width: 1em;
  height: 1em;
  vertical-align: -0.15em;
  fill: currentColor;
  overflow: hidden;
}
</style>
